home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / text / hyper / ADtoHT2_1.lha / Source.lha / MyLib.lha / string / memcmp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-09  |  474 b   |  27 lines

  1. #include <string.h>
  2.  
  3. /************************************************************************/
  4.  
  5. int (memcmp)(const void *Memory1, const void *Memory2, size_t Size)
  6.  
  7. {
  8. #ifdef __SASC
  9.   return __builtin_memcmp(Memory1,Memory2,Size);
  10. #else
  11.   int Result;
  12.  
  13.   Result=0;
  14.   if (Size != 0)
  15.     {
  16.       const unsigned char *t1;
  17.       const unsigned char *t2;
  18.  
  19.       t1=Memory1;
  20.       t2=Memory2;
  21.       while (!(Result=*t1++-*t2++) && (--Size != 0))
  22.     ;
  23.     }
  24.   return Result;
  25. #endif
  26. }
  27.